Technote 1185New ColorSync 3.0 APIs |
CONTENTS
System Requirements |
This Technote describes the APIs your application can use to take advantage of new features available in ColorSync 3.0. |
Boolean CheckIfColorSyncAvailableOnPPC (void) { Boolean ColorSyncAvailable = false; long gestaltResponse; if (Gestalt(gestaltColorMatchingAttr, &gestaltResponse) == noErr) { ColorSyncAvailable = gestaltResponse & (1 << gestaltColorMatchingLibLoaded); } return ColorSyncAvailable; } |
Alternately, you can use the ColorSync function
The |
#define kColorSync3 0x00000300 CMError err; UInt32 version; err = CMGetColorSyncVersion(&version); if (err == noErr) { if (version >= kColorSync3) { /* ColorSync 3 is installed */ } } else { /* ColorSync not present */ } |
Getting ColorSync 3.0 Version Information
As described in the section above, use the ColorSync
Alternately, you can use the
You can modify and use the following sample code to test for version 3.0 of the ColorSync Manager. This function initializes the |
#define kColorSync3 0x00000300 Boolean CheckForColorSyncVersion3(void) { Boolean ColorSyncAvailable = false; long version; if (Gestalt(gestaltColorMatchingVersion, &version) == noErr) { if (version >= kColorSync3) { ColorSyncAvailable = true; } } return ColorSyncAvailable; } |
enum { cmInputUse = 'inpt', cmOutputUse = 'outp', cmDisplayUse = 'dply', cmProofUse = 'pruf' }; |
cmInputUse | Specifies the preferred input device profile. |
cmOutputUse | Specifies the preferred output device profile. |
cmDisplayUse | Specifies the preferred display device profile. |
cmProofUse | Specifies the preferred proofing device profile. |
The |
pascal CMError CMGetDefaultProfileByUse ( OSType use, CMProfileRef * prof); |
The |
pascal CMError CMSetDefaultProfileByUse ( OSType use, CMProfileRef prof); |
Working With Default Profiles for DocumentsWith ColorSync 3.0, users can specify default document profiles for RGB, CMYK, Gray, and Lab color spaces with the ColorSync control panel. (Previous ColorSync versions could only set profiles for RGB and CMYK spaces.) Your application can use these profiles both when opening files and when creating new files. For example, if a document contains an RGB image that doesn't have an embedded profile, you might use the RGB default document profile. Similarly, when a user creates a new RBG document, you can create the image in the color space of the same RGB default profile, or perhaps of the display device profile. The following illustration shows the default settings for the document color space profiles. Users can change these settings individually, or by changing to a new workflow (which specifies device profiles, document profiles, and preferred CMM). Workflows are described in detail in "About ColorSync 3.0." ![]() Figure 2 - Default Profiles
Your application can get and set default document profiles for various color spaces using the functions |
enum { cmXYZData = 'XYZ ', cmLabData = 'Lab ', cmRGBData = 'RGB ', cmGrayData = 'GRAY', cmCMYKData = 'CMYK' }; |
cmXYZData | Specifies XYZ space. |
cmLabData | Specifies LAB space. |
cmRGBData | Specifies RGB space. |
cmGrayData | Specifies Gray space. |
cmCMYKData | Specifies CMYK space. |
The CMGetDefaultProfileBySpace
function is defined as follows:
pascal CMError CMGetDefaultProfileBySpace ( OSType dataColorSpace, CMProfileRef * prof); |
The |
pascal CMError CMSetDefaultProfileBySpace ( OSType dataColorSpace, CMProfileRef prof); |
Getting the Preferred CMM
Starting with ColorSync 2.5, a user can set a preferred CMM with the
ColorSync control panel and your application can obtain the preferred CMM by calling the |
pascal CMError CMGetPreferredCMM ( OSType * cmmType, Boolean * preferredCMMnotfound); |
Launching the ColorSync Control Panel From Your Application |
Note: |
With ColorSync 3.0, your application can launch the ColorSync control panel to solicit color choices, including default profiles for devices and documents, as well as preferred CMM. Users can also switch between named collections of color settings called workflows (described in detail in "About ColorSync 3.0"). Many applications have made the decision to take responsibility for color management preferences as part of their user interface (UI). Now, with the ability to launch the ColorSync control panel from within an application, perhaps some or all of that extra UI and code can be eliminated, and users can be exposed to a standard color management UI, provided by ColorSync. To launch the ColorSync control panel from your application, you call the following function: |
pascal CMError CMLaunchControlPanel (UInt32 flags); |
When your application calls the |
DownloadablesTo contact us, please use the Contact Us page.
|